package sg.edu.nus.iss.billing.model.charge;

import sg.edu.nus.iss.billing.model.BaseModel;
import sg.edu.nus.iss.billing.model.bill.Bill;
import sg.edu.nus.iss.billing.model.calculation.IChargeMethod;
import sg.edu.nus.iss.billing.model.subscription.ISubscribable;

/**
 * @author ZiFeng, Thurien, YinNi
 *
 */
public class Fee extends BaseModel implements IChargable {

	private static final long serialVersionUID = 1L;
	private IChargeMethod chargeMethod;
	private String description;
	protected Rate rate;
	private ISubscribable chargingService;

	public Fee(ISubscribable chargingService, String description) {
		this.chargingService = chargingService;
		this.description = description;

	}

	@Override
	public double charge(Bill chargingBill) {
		return this.chargeMethod.calculate(this, chargingBill);
	}

	@Override
	public ISubscribable getChargingService() {
		return this.chargingService;
	}

	@Override
	public String getDescription() {
		return this.description;
	}

	@Override
	public Rate getRate() {
		return this.rate;
	}

	@Override
	public void setChargeMethod(IChargeMethod chargeMethod) {
		this.chargeMethod = chargeMethod;

	}

	@Override
	public void setDescription(String description) {
		this.description = description;

	}

	@Override
	public void setRate(Rate rate) {
		this.rate = rate;

	}

}
